using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NNFramework.NeuroLibrary;

namespace NeuroLibraryTest
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class UnitTest1
    {
        public UnitTest1()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void TestNeuroClass()
        {
            double dblResult = 0;
            clsNeuron<int, double> objNeuron = new clsNeuron<int, double>(clsActivationFunctions.AdalineFunction);            
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(0);
            objNeuron.AddDendrite(1);
            objNeuron.EvaluateMe();
            dblResult = objNeuron.Axon;
            objNeuron.AddDendrite(2);
            objNeuron.AddDendrite(1);
            objNeuron.EvaluateMe();
            dblResult = objNeuron.Axon;            
        }


        [TestMethod]
        public void TestLayerClass()
        {
            //double dblResult = 0;
            clsLayer<double, double> objLayer = new clsLayer<double, double>(LayerType.InputLayer);
            clsNeuron<double, double> objNeuron = new clsNeuron<double, double>(clsActivationFunctions.AdalineFunction);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(0);
            objNeuron.AddDendrite(1);           
            objNeuron.AddDendrite(2);
            objNeuron.AddDendrite(1);
            objLayer.AddNeuron(objNeuron);
            objNeuron = new clsNeuron<double, double>(clsActivationFunctions.AdalineFunction);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(0);
            objNeuron.AddDendrite(0);
            objNeuron.AddDendrite(1);            
            objNeuron.AddDendrite(objLayer.Neurons[0], (int)objLayer.Neurons[0].Axon);
            objLayer.AddNeuron(objNeuron);

        }

        [TestMethod]
        public void TestTypes()
        {
            clsLayer<double, double> objLayer = new clsLayer<double, double>(LayerType.InputLayer);
            clsNeuron<double, double> objNeuron = new clsNeuron<double, double>(clsActivationFunctions.AdalineFunction);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(0);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(2);
            objNeuron.AddDendrite(1);
            objLayer.AddNeuron(objNeuron);
            objNeuron = new clsNeuron<double, double>(clsActivationFunctions.AdalineFunction);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(0);
            objNeuron.AddDendrite(0);
            objNeuron.AddDendrite(1);
            objNeuron.AddDendrite(objLayer.Neurons[0], (int)objLayer.Neurons[0].Axon);
            objLayer.AddNeuron(objNeuron);
            objLayer.FullConnectToLayer(objLayer);
        }

                
    }
}
